package com.pkk.penguin.frame.know.java.Javacoreknowledge.thread.callable;

import java.util.concurrent.Callable;

/**
 * @description: 带返回值的线程处理器
 * @author: peikunkun
 * @create: 2019-12-23 18:14
 **/
public class CallableThread implements Callable<String> {


  /**
   * 消息体
   */
  private String message;

  public CallableThread(String message) {
    this.message = message;
  }

  /**
   * Computes a result, or throws an exception if unable to do so.
   *
   * @return computed result
   * @throws Exception if unable to compute a result
   */
  @Override
  public String call() throws Exception {
    System.out.println("--->当前线程:" + message);
    return message;
  }
}
